package com.nbicc.core.utils;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

/**
 * @Author: lilingyan
 */
public class ToolUtils {

    public static String generateUUID32() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }

    public static Map<String , String> splitUriQuery(String uriQuery){
        Map<String, String> mapRequest = new HashMap<String, String>();
        String[] arrSplit=null;
        arrSplit=uriQuery.split("[&]");
        for(String strSplit:arrSplit){
            String[] arrSplitEqual=null;
            arrSplitEqual= strSplit.split("[=]");
            //解析出键值
            if(arrSplitEqual.length>1){
                //正确解析
                mapRequest.put(arrSplitEqual[0], arrSplitEqual[1]);
            }else{
                if(arrSplitEqual[0]!=""){
                    //只有参数没有值，不加入
                    mapRequest.put(arrSplitEqual[0], "");
                }
            }
        }
        return mapRequest;
    }

}
